package com.ewanghuiju.app.ui.shopmail.adapter;

import android.graphics.drawable.GradientDrawable;
import android.text.TextPaint;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ewanghuiju.app.R;
import com.ewanghuiju.app.model.bean.response.IntenestTagResponBean;
import com.ewanghuiju.app.util.SystemUtil;

/**
 * @author sj  qq:751943509
 * @class 返利顶部tab 切换   实体类用  IntenestTagResponBean
 * @time 2020/2/20
 */
public class FanliTopTagAdapter extends BaseQuickAdapter<IntenestTagResponBean, BaseViewHolder> {
    public FanliTopTagAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    protected void convert(BaseViewHolder helper, IntenestTagResponBean item) {
        TextView tv_tag = helper.getView(R.id.tv_fanli_order_tag);
        GradientDrawable gradientDrawable = (GradientDrawable) tv_tag.getBackground();
        tv_tag.setText(item.getText());
        TextPaint tp = tv_tag.getPaint();
        if (item.getStatus() == 0) {
            tp.setFakeBoldText(false);
            tv_tag.setTextColor(mContext.getResources().getColor(R.color.color_999));
            gradientDrawable.setColor(mContext.getResources().getColor(R.color.color_fdfafe));
            gradientDrawable.setStroke(SystemUtil.dp2px(0.5f), mContext.getResources().getColor(R.color.color_999));
        } else if (item.getStatus() == 1) {
            tp.setFakeBoldText(true);
            tv_tag.setTextColor(mContext.getResources().getColor(R.color.colorPrimary));
            gradientDrawable.setColor(mContext.getResources().getColor(R.color.color_f6d1d2));
            gradientDrawable.setStroke(SystemUtil.dp2px(0.5f), mContext.getResources().getColor(R.color.color_f6d1d2));
        }
    }
}
